package thread;

import javax.xml.namespace.QName;

/**
 * 获取线程相关信息得一组方法
 */
public class ThreadInfoDemo {
    public static void main(String[] args) {
        Thread main=Thread.currentThread();
        String name=main.getName();//获取线程得名字
        System.out.println("名字:"+name);

        Long id=main.getId();//获取线程得唯一标识
        System.out.println("id:"+id);

        int priority=main.getPriority();//获取线程优先级
        System.out.println("priority："+priority);

        boolean isAlive=main.isAlive();
        boolean isDaemon=main.isDaemon();
        boolean isInterrupted=main.isInterrupted();
        System.out.println("是否活着："+isAlive);
        System.out.println("是否为守护线程："+isDaemon);
        System.out.println("是否被中断："+isInterrupted);


    }
}
